<template>
  <el-dialog :visible="true" title="素材预览" :before-close="close">
    <div class="preview-box">
      <el-image v-if="type === 4" style="height: 100%" :src="src" fit="fit" />
      <video
        v-if="type === 1"
        style="height: 100%; max-width: 900px"
        :src="src"
        controls
      />
    </div>
  </el-dialog>
</template>

<script>
export default {
  name: "PreviewSource",
  props: {
    type: {
      type: Number,
      default: 4,
    },
    src: {
      require: true,
      type: String,
      default: "",
    },
  },
  methods: {
    close() {
      this.$emit("close");
    },
  },
};
</script>

<style lang="scss" scoped>
.preview-box {
  display: flex;
  justify-content: center;
  height: 550px;
}
</style>